package com.example.lanqiaodemo1.JavaTest6;

public class Student implements Comparable<Student> {
    public String name;
    public String sex;
    public int age;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Student(String name, String sex, int age) {
        super();
        this.name = name;
        this.sex = sex;
        this.age = age;
    }

    @Override
    public String toString() {
        return "Student [name=" + name + ", sex=" + sex + ", age=" + age + "]";
    }

    @Override
    public int compareTo(Student o) {
        // TODO Auto-generated method stub
        return this.age - o.age;
    }








}
